#!/bin/bash

mvn -Dmaven.test.skip -U clean package

jps -l | grep supreme-oms-server | awk '{print $1}'
kill -9 $(jps -l | grep supreme-oms-server | awk '{print $1}')

docker images | grep none | awk '{print $3}' | xargs docker rmi
docker images -f label="name=supreme-oms-server" -q | xargs docker rmi -f

docker build \
--platform linux/amd64 \
--build-arg DockerArgName=DockerArgBuild \
-t supreme/supreme-oms-server:latest .

docker run \
--platform linux/amd64 \
--rm \
--name supreme-oms-server \
-e ProjectDir=fuck-docker-home \
-p 7261:7260 \
-d \
supreme/supreme-oms-server:latest \
&& docker logs -f supreme-oms-server

docker run \
--platform linux/amd64 \
--rm \
--name supreme-oms-server \
-e EnvLabel=DockerEnvLabelCmdRun \
-e EnvValue=DockerEnvValueCmdRun \
-p 7261:7260 \
-d \
supreme/supreme-oms-server:latest \
--server-custom.docker-arg-label=DockerArgLabelCmdRun \
--server-custom.docker-arg-value=DockerArgValueCmdRun \
&& docker logs -f supreme-oms-server

version=0.0.3 docker-compose build \
--force-rm \
--build-arg ArgLabel=ComposeArgLabelCmdBuild \
--build-arg ArgValue=ComposeArgValueCmdBuild

docker run --rm --name supreme-oms-server -p 8260:7260 -d supreme/supreme-oms-server

scp target/supreme-oms-server-0.0.1.jar root@$OMSA_HOST:/opt
scp target/supreme-oms-server-0.0.1.jar root@$OMSB_HOST:/opt
scp target/supreme-oms-server-0.0.1.jar root@$DGGY_HOST:/opt
scp target/supreme-oms-server-0.0.1.jar root@$SCRM_HOST:/opt
